package org.kent.w.base.api.exception;

import org.kent.w.base.api.code.IResponseCode;

import java.text.MessageFormat;

/**
 * 业务异常
 *
 * @author wu.jigang@geely.com
 * @version 1.0
 * @Date :Created by 2020/3/2.
 */
public class BizException extends BaseRuntimeException {

    private static final long serialVersionUID = -6090192296070975995L;

    public BizException(IResponseCode responseCode, Object ... args) {
        this(responseCode.getCode(), responseCode.getMessage(), args);
    }

    public BizException(IResponseCode responseCode, Throwable cause, Object ... args) {
        this(responseCode.getCode(), responseCode.getMessage(), cause, args);
    }

    public BizException(int errorCode, String message, Object ... args) {
        super(errorCode, MessageFormat.format(message, args));
    }

    public BizException(int errorCode, String message, Throwable cause, Object ... args) {
        super(errorCode, MessageFormat.format(message, args), cause);
    }

}
